const { upgrades,ethers } = require("hardhat")

async function  main() {
    const NFTMarket = await ethers.getContractFactory("NFTTrMarket")

    const box = await upgrades.deployProxy(NFTMarket, [42], { kind: "transparent" });
    await box.waitForDeployment();
    let boxaddress = await box.getAddress();
    console.log("Box deployed to:", boxaddress);
    const [firstAccount] = await ethers.getSigners()
    console.log("x=", await  box.getX());

    const BoxV2 = await ethers.getContractFactory("NFTTrMarketV2");
    const box2 = await upgrades.upgradeProxy(boxaddress, BoxV2);
    await box2.waitForDeployment()

    console.log("box2 deployed to:",await box2.getAddress());
    console.log("x=", await  box2.getX());
}


main().then().catch(err => {
    console.error(err)
    process.exit(1)
})